<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue基础</title>
    <script src="../../js/vue.js" type="text/javascript"></script>
</head>
<body>
<div id="root">

</div>
<script type="text/javascript">
    Vue.config.productionTip = false;
    let number = 18;
    //Object.defineProperty
    let person = {
        name:'tom'
    }

    Object.defineProperty(person,'age',{
        get(){
            return number
        },
        set(value){
            number = value;
        }
    });

    //数据代理，一个对象通过代理对象进行操作

    let obj1 = {x:100}
    let obj2 = {y:200}

    Object.defineProperty(obj2,'x',{
       set(value){
           obj1.x = value;
       },
        get(){
           return obj1.x;
        }
    });



    const vm = new Vue({
        data(){
            return {}
        }
    });
    vm.$mount('#root');
</script>
</body>
</html>